/*
 *  OneShareView
 *  created by qinghong
 *  2016-8-16
 */

/*
 * 定制版OneShareView,底部弹出的设置页面
 */

import React, { Component } from 'react';
import {
    StyleSheet,
    Text,
    View,
    Image,
    TouchableOpacity,
    Animated
} from 'react-native';

import Constants from '../../Constants';

export default class OneShareView extends Component {

    // 构造
    constructor(props) {
        const { shareViewIsShown } = this.props;
        const shareViewTop = shareViewIsShown ? Constants.window.screenHeight - 300 : Constants.window.screenHeight;
        super(props);
        // 初始状态
        this.state = {
            shareViewTop: new Animated.Value(shareViewTop)
        };
    }

    showShareView() {
        Animated.spring(this.state.shareViewTop, {
            toValue: Constants.window.screenHeight - 600, // 目标值
            duration: 5000, // 动画时间
            easing: Easing.linear // 缓动函数
        }).start();
    }

    hideShareView() {
        Animated.spring(this.state.shareViewTop, {
            toValue: Constants.window.screenHeight - 600, // 目标值
            duration: 5000, // 动画时间
            easing: Easing.linear // 缓动函数
        }).start();
    }

    render() {
        return (
            <Animated.View style={styles.shareView}>
                <Text>
                    {'啦啦啦啦啦\n滴滴滴滴滴\n哒哒哒哒哒'}
                </Text>
                <Text>
                    {'111111111\n2222222\n333333333'}
                </Text>
            </Animated.View>
        );
    }
}

const styles = StyleSheet.create({
    shareView: {
        position: 'absolute',
        zIndex: 1,
        backgroundColor: 'red',
        width: Constants.window.screenWidth,
        height: 200
    }
});

